#include "SplitString.h"
#include <string.h>

SplitString::SplitString()
{
}


SplitString::~SplitString()
{
}

vector<string> SplitString::operator()(const char *target, const char *delim)
{
	vector<string> v;
	int length = strlen(target);
	char *s = new char[length + 1];
	strcpy(s, target);
	char *p = strtok(s, delim);
	while (p)
	{
		v.push_back(p);
		p = strtok(NULL, delim);
	}
	delete[] s;
	return v;
}

vector<string> SplitString::operator()(string &target, const char *delim)
{
	return operator()((char*)target.c_str(), delim);
}
